import Vue from 'vue'
import VueRouter from 'vue-router';

import Login from "../components/Login"
import Home from "../views/Home"
import Welcome from "../components/Welcome";
import Feature from "../components/Feature";

Vue.use(VueRouter);

const routes = [
  {path:"/",redirect:"/home"},
  {path:"/login",component:Login},
  {
    path:"/home",
    component:Home,
    redirect:"/welcome",
    children:[
      {path:"/welcome",component:Welcome},
      {path:"/Feature",component:Feature}
    ]
  }
];

const router = new VueRouter({
  routes
});

// router.beforeEach((to, from, next) => {
//   if(to.path == "/login") return next();
//   var username = window.sessionStorage.getItem("username");
//   if(!username){
//      return next("/login");
//   }
//   next();
// });

export default router
